<?php require_once '../conn/DBconnect.php';
$runnerCtr = 1;
if(isset($_GET["runner"]))
	$runnerCtr = $_GET["runner"];

if($runnerCtr == 1){	
?>
	<div id="arHeader" class="formItem">
		<div class="formLabel" style="width:140px;font-weight: bold">First Name</div>
		<div class="formLabel" style="width:145px;font-weight: bold">Last Name</div>
		<div class="formLabel" style="width:30px;font-weight: bold">MI</div>
		<div class="formLabel" style="width:80px;font-weight: bold">Category</div>
		<div class="formLabel" style="width:90px;font-weight: bold">Size</div>
		<div class="formLabel" style="width:90px;font-weight: bold">Color</div>
	</div>
	
<?php 
}?>

<div id="ar<?php echo $runnerCtr?>" class="dynaFormContent">
	<div class="formItem">
		<div>
		<input type="text" name="firstName" class="formInputAlphabet" maxlength="50" style="width:130px;"/>
		<input type="text" name="lastName" class="formInputAlphabet" maxlength="50" style="width:130px;"/>
		<input type="text" name="middleInitial" class="formInputAlphabet" maxlength="1" style="width:20px;"/>
		
			<select name="arcategory" class="formInput" style="width:80px;">
			<?php 
			$raceCatSQL = "call sp_race('LIST','EVENT',1);";
		
			$result = mysqli_query($mysqlLink, $raceCatSQL);
			while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
				echo "<option value='". $row["race_code"]."'>".$row["race_distance"]."</option>";			
			}
			
			mysqli_free_result($result);
			mysqli_next_result($mysqlLink); 
			?>
			</select>
		
			<select name="arkitsize" class="formInput"  style="width:80px;">
			<?php 
			$kitSizeSQL = "call sp_kit('LIST','EVENT_KIT_SIZE', 1, 1, null);";
			
			$resultSize = mysqli_query($mysqlLink, $kitSizeSQL);
			
			$checkItem = false;
			if($resultSize->num_rows == 1)
				$checkItem = true;
				
			while ($rowSize = mysqli_fetch_array($resultSize, MYSQLI_ASSOC)) {
				echo "<option value='". $rowSize["ks_code"]."'>".$rowSize["ks_desc"]."</option>";
			}
			
			mysqli_free_result($resultSize);
			mysqli_next_result($mysqlLink); 
			?>
			</select>
		
			<select name="arkitcolor" class="formInput"  style="width:80px;">
			<?php 
			$kitColorSQL = "call sp_kit('LIST','EVENT_KIT_COLOR', 1, 1, null);";
			
			$resultColors = mysqli_query($mysqlLink, $kitColorSQL);
			
			$checkItem = false;
			if($resultColors->num_rows == 1)
				$checkItem = true;
				
			while ($rowColor = mysqli_fetch_array($resultColors, MYSQLI_ASSOC)) {
				echo "<option value='". $rowColor["kc_code"]."'>".$rowColor["kc_code"]."</option>";
			}
			
			mysqli_free_result($resultColors);
			mysqli_close($mysqlLink);
			?>
			</select>
			<img src="../images/remove16x16.png" alt="Remove" onclick="removeRunner('#ar<?php echo $runnerCtr?>')" style="cursor: pointer;"> 
		</div>
	</div>
</div>